﻿using UnityEngine;

namespace Assets.XyzCode.Fight.Game.Enemy.Think
{
    /// <summary>
    /// 思考 - 靠近玩家
    /// </summary>
    public class Think_ApproachPlayer : IThink
    {
        // @Override
        public void DoThink(Enemy_X_Behav behav)
        {
            if (null == behav)
            {
                return;
            }

            // 获取玩家
            GameObject goPlayer = GameObject.Find("/Game/Player_MissDie_");

            if (null == goPlayer)
            {
                return;
            }

            // 获取目标位置
            Vector3 targetPos = goPlayer.transform.position;
            targetPos += Vector3.forward * Random.Range(-3f, 3f);
            targetPos += Vector3.right * Random.Range(-3f, 3f);

            // 执行跑动
            behav.DoRun(targetPos);
        }
    }
}
